package offer.linkedList;

/**
 * @author DengYuan2
 * @create 2021-03-07 10:26
 */
public class NC4 {
    public static void main(String[] args) {
        Integer w1=1234;
        Integer w2=1234;
        Integer w3 = Integer.valueOf(123);
        Integer w4 = new Integer(123);
//        System.out.println(w1==w4);
//        System.out.println(w1.equals(w4));
        System.out.println(w1==w2);
        System.out.println(w1.equals(w2));
    }

    public boolean hasCycle(ListNode head) {
        if (head == null) {
            return false;
        }
        ListNode slow = head;
        ListNode fast = head;

        while (fast != null && fast.next != null) {
            slow = slow.next;
            fast = fast.next.next;
            if (slow == fast) {
                return true;
            }
        }
        return false;

    }
}
